home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kbookmarkimporter.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.9 KB  |  107 lines

  1. //  -*- c-basic-offset:4; indent-tabs-mode:nil -*-
  2. // vim: set ts=4 sts=4 sw=4 et:
  3. /* This file is part of the KDE libraries
  4.    Copyright (C) 2000 David Faure <faure@kde.org>
  5.  
  6.    This library is free software; you can redistribute it and/or
  7.    modify it under the terms of the GNU Library General Public
  8.    License version 2 as published by the Free Software Foundation.
  9.  
  10.    This library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Library General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Library General Public License
  16.    along with this library; see the file COPYING.LIB.  If not, write to
  17.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.    Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef __kbookmarkimporter_h
  22. #define __kbookmarkimporter_h
  23.  
  24. #include <qdom.h>
  25. #include <qcstring.h>
  26. #include <qstringlist.h>
  27. #include <ksimpleconfig.h>
  28.  
  29. #include "kbookmark.h"
  30.  
  31. /**
  32.  * A class for importing NS bookmarks
  33.  * KEditBookmarks uses it to insert bookmarks into its DOM tree,
  34.  * and KActionMenu uses it to create actions directly.
  35.  * @since 3.2
  36.  */
  37. class KIO_EXPORT KBookmarkImporterBase : public QObject
  38. {
  39.     Q_OBJECT
  40. public:
  41.     KBookmarkImporterBase() {}
  42.     virtual ~KBookmarkImporterBase() {}
  43.  
  44.     void setFilename(const QString &filename) { m_fileName = filename; }
  45.  
  46.     virtual void parse() = 0;
  47.     virtual QString findDefaultLocation(bool forSaving = false) const = 0;
  48.  
  49.     // TODO - make this static?
  50.     void setupSignalForwards(QObject *src, QObject *dst);
  51.     static KBookmarkImporterBase *factory(const QString &type);
  52.  
  53. signals:
  54.     /**
  55.      * Notify about a new bookmark
  56.      * Use "html" for the icon
  57.      */
  58.     void newBookmark(const QString & text, const QCString & url, const QString & additionalInfo);
  59.  
  60.     /**
  61.      * Notify about a new folder
  62.      * Use "bookmark_folder" for the icon
  63.      */
  64.     void newFolder(const QString & text, bool open, const QString & additionalInfo);
  65.  
  66.     /**
  67.      * Notify about a new separator
  68.      */
  69.     void newSeparator();
  70.  
  71.     /**
  72.      * Tell the outside world that we're going down
  73.      * one menu
  74.      */
  75.     void endFolder();
  76.  
  77. protected:
  78.     QString m_fileName;
  79.  
  80. private:
  81.     class KBookmarkImporterBasePrivate *d;
  82. };
  83.  
  84. /**
  85.  * A class for importing XBEL files
  86.  */
  87. class KIO_EXPORT KXBELBookmarkImporterImpl : public KBookmarkImporterBase, protected KBookmarkGroupTraverser
  88. {
  89.     Q_OBJECT
  90. public:
  91.     KXBELBookmarkImporterImpl() {}
  92.     virtual void parse();
  93.     virtual QString findDefaultLocation(bool = false) const { return QString::null; }
  94. protected:
  95.     virtual void visit(const KBookmark &);
  96.     virtual void visitEnter(const KBookmarkGroup &);
  97.     virtual void visitLeave(const KBookmarkGroup &);
  98. private:
  99.     class KXBELBookmarkImporterImplPrivate *d;
  100. };
  101.  
  102. // for SC
  103. #include "kbookmarkimporter_ns.h"
  104. #include "kbookmarkimporter_kde1.h"
  105.  
  106. #endif
  107.